//
//  Device+AD.swift
//  ADKit
//
//  Created by Adoma on 2023/12/26.
//

import DeviceKit
import SwiftyJSON

extension Device {
    
    public var deviceid: String {
        
        let kechain = KeychainStorage(service: "\(Bundle.main.identifier).device")
        if let uuid = kechain.string(for: .deviceid) {
            return uuid
        }
        
        let created = UUID().uuidString
        kechain.set(string: created, for: .deviceid)
        
        return created
    }
}

fileprivate extension DataStorageType.Key {
    static let deviceid = "Device.id"
}
